<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>Blog</title>
	<link rel="stylesheet" href="/stylesheets/bootstrap.min.css">
	<link rel="stylesheet" href="/stylesheets/header.css">
	<link rel="stylesheet" href="/stylesheets/article.css">
	<link href='https://cdn.webfont.youziku.com/webfonts/nomal/107450/45803/59a915bef629d808084fd878.css' rel='stylesheet'>
</head>
<body>
	<%- include header.ejs %>
	<div class="container">
		<article class="contianer article">
		    <% if (success) { %>
		    <div><%= success %></div>
		    <% } %>
		    <% if (error) { %>
		    <div><%= error %></div>
		    <% } %>
			<% if(user &&(user.name==post.name)) { id = post._id.toString(); %>
			<a href="/edit/<%= id %>">修改</a>
			<a href="/remove/<%= id %>">删除</a>
			<% } %>
			<h2 class="title"><%= post.title %></h2>
			<hr>
			<p class="writer">作者：<a href="/u/<%= post.name %>"><%= post.name %></a>&nbsp;|&nbsp;发布时间：<%= post.time.minute %></p>
			<p class="artilce-body"><%- post.post %></p>
			<p class="pv-comments">阅读：<%= post.pv %>|评论：<%= post.comments.length %></p>
			<hr>
			<% if (post.comments) { %>
			<% post.comments.forEach(function(comment,index){ %>
			<div class="comment">
				<p class="commenter"><%= comment.name%><sapn class="comment-date">回复于<%= comment.time%></sapn></p>
			<p class="comment-content"><%- comment.content%></p>
			</div>
			<% }) %>
			<% }%>
			<form class="comment-bar" method="post">
				<div class="form-group">
					<label for="inputName">姓名：</label>
					<input type="text" name="name" class="form-control" id="inputName" placeholder="Busi Chen" required="required">
				</div>
				<div class="form-group">
					<label for="inputEmail">邮箱：</label>
					<input type="email" name="email" class="form-control" id="inputEmail" placeholder="chenwei@example.com">
				</div>
				<div class="form-group">
					<label for="inputContent">评论：</label>
					<textarea class="form-control" id="inputContent" name="content" placeholder="留下你的观点。。。"></textarea>
				</div>
				<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-send"></span>&nbsp;评论</button>
			</form>
		</article>
	</div>
	<script type="text/javascript" src="/javascripts/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="/javascripts/bootstrap.min.js"></script>
</body>
</html>
